package com.ruoyi.business.domain.vo;

import com.ruoyi.business.domain.Course;
import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 计划管理对象 plain
 *
 * @author 吴倩芸
 * @date 2023-03-09
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class PlainVo extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    private Long id;

    /**
     * 计划名
     */
    @Excel(name = "计划名")
    private String plainNam;

    /**
     * 计划时间用---;---分割开
     */
    @Excel(name = "计划时间用---;---分割开")
    private String plainTime;

    /**
     * 计划用---;---分隔开
     */
    @Excel(name = "计划用---;---分隔开")
    private String plainContext;

    /**
     * 课程id
     */
    @Excel(name = "课程id")
    private Long courseId;

    private Course course;

    private class PlainDetail {
        private String time;

        private String context;

        // 有签到
        private Boolean hasSignIn;

        // 有签退
        private Boolean hasSignOut;

        // 签到签退完成
        private Boolean alreadySign;

        public PlainDetail() {
        }

        public PlainDetail(String time, String context) {
            this.time = time;
            this.context = context;
        }

        public PlainDetail(String time, String context, Boolean hasSignIn, Boolean hasSignOut, Boolean alreadySign) {
            this.time = time;
            this.context = context;
            this.hasSignIn = hasSignIn;
            this.hasSignOut = hasSignOut;
            this.alreadySign = alreadySign;
        }

        public String getTime() {
            return time;
        }

        public void setTime(String time) {
            this.time = time;
        }

        public String getContext() {
            return context;
        }

        public void setContext(String context) {
            this.context = context;
        }

        public Boolean getHasSignIn() {
            return hasSignIn;
        }

        public void setHasSignIn(Boolean hasSignIn) {
            this.hasSignIn = hasSignIn;
        }

        public Boolean getHasSignOut() {
            return hasSignOut;
        }

        public void setHasSignOut(Boolean hasSignOut) {
            this.hasSignOut = hasSignOut;
        }

        public Boolean getAlreadySign() {
            return alreadySign;
        }

        public void setAlreadySign(Boolean alreadySign) {
            this.alreadySign = alreadySign;
        }
    }

    public void addPlainDetails(String time, String context, Boolean hasSignIn, Boolean hasSignOut, Boolean alreadySign) {
        if (null == plainDetails) {
            plainDetails = new ArrayList<>();
        }
        plainDetails.add(new PlainDetail(time, context, hasSignIn, hasSignOut, alreadySign));
    }

    private List<PlainDetail> plainDetails;

    public List<PlainDetail> getPlainDetails() {
        if (null == plainDetails) {
            return null;
        }
        return plainDetails;
    }

    public String getCourseId() {
        if (null == courseId) {
            return null;
        }
        return Long.toString(courseId);
    }


}
